<?php
Class Pre_system {
	/**
	 *
	 * Enter description here ...
	 */
	function install_check()
	{
		if ( ! preg_match('/admin\/install/', $_SERVER['REQUEST_URI']) &&
			! file_exists(APPPATH.'config/base.php'))
		{
			// Log a little message so we know where we are
			log_message('error', 'Config file "base.php" doesn\'t exist');

			// Oh dear, the config file isn't there!  Does the install controller still exist?
			if (! file_exists(APPPATH.'controllers/admin/install.php'))
			{
				// Oh dear, the installation must be corrupt, display an error
				log_message('error', 'Install controller has been removed, exiting...');
				show_error('Fatal error, site not installed', 500);
			}
			else
			{
				// No helpers are loaded, so let's redirect the old fashioned way!
				header("Refresh:0;url=admin/install/");
			}
		}
		return TRUE;
	}
}